Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Carry #102 : improvements for command help#126

Closed
vdemeester wants to merge 2 commits into
docker-archive-public:masterfrom
vdemeester:carry-pr-102
Closed

Carry #102 : improvements for command help#126
vdemeester wants to merge 2 commits into
docker-archive-public:masterfrom
vdemeester:carry-pr-102

Conversation

@vdemeester
Copy link
Copy Markdown
Contributor

Closes #101, Carrying #102 and makes help on commands (description, usage and such) more close to what docker-compose does 🐰. It is not mandatory but 😝.

It looks like that :

$ .libcompose-cli help up
WARN[0000] Note: This is an experimental alternate implementation of the Compose CLI (https://github.com/docker/compose) 
Builds, (re)creates, starts, and attaches to containers for a service.

Unless they are already running, this command also starts any linked services.

The `libcompose-cli up` command aggregates the output of each container. When
the command exits, all containers are stopped. Running `libcompose-cli up -d`
starts the containers in the background and leaves them running.

If there are existing containers for a service, and the service's configuration
or image was changed after the container's creation, `libcompose-cli up` picks
up the changes by stopping and recreating the containers (preserving mounted
volumes). To prevent Compose from picking up changes, use the `--no-recreate`
flag.

If you want to force Compose to stop and recreate all containers, use the
`--force-recreate` flag.

Usage: libcompose-cli_linux-amd64 up [options] [SERVICE...]

Options:
   -d                   Do not block and log
   --no-recreate        If containers already exist, don't recreate them. Incompatible with --force-recreate.
   --force-recreate     Recreate containers even if their configuration and image haven't changed. Incompatible with --no-recreate.

$ libcompose-cli help pull
WARN[0000] Note: This is an experimental alternate implementation of the Compose CLI (https://github.com/docker/compose) 
Pulls images for services.

Usage: libcompose-cli_linux-amd64 pull [SERVICE...]
  • Find a better way for description
  • Re-order commands (alphabetically, like docker-compose)

At some point we should remove the WARN and make it clear elsewhere (like on the main help/usage command), but that's another story/PR 😉.

/cc @dnephin @aanand @ibuildthecloud

🐸

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Comment thread cli/command/command.go
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unfortunate we need the back-tics in the string; having to do all the concatenation and \n\n for new lines looks tedious

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah 😓 I'm looking around to see a better way to do that (and hopefully, I'll find one).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, also thinking what a solution would be. Perhaps a separate TOML file containing the strings/descriptions? idk

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thaJeztah I wonder, I could also use backticks to not have to escape the carriage-return but.. I had trouble with them for these (backticks inside backticks…).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking if GoDoc can be used somehow, I know @calavera did some experimenting in this area in this PR moby/moby#16125. However (obviously) that's used to generate external documentation, not for usage in the output of the software itself

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spf13/cobra has a good way of dealing with this I think: https://github.com/spf13/cobra#manually-create-rootcmd

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like that also uses back-tics for quotes. Still might be worth looking into; something that's easy to maintain and reusable

Big thanks to @bohai :)

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
@vdemeester vdemeester changed the title Carry pr 102 : improvements for command help Carry #102 : improvements for command help Jan 9, 2016
@vdemeester
Copy link
Copy Markdown
Contributor Author

I'm closing this for now, will handle this when migration to spf13/cobra 😉

@vdemeester vdemeester closed this Jan 23, 2016
@vdemeester vdemeester deleted the carry-pr-102 branch September 7, 2018 22:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Two improvements about libcompose command help

4 participants